package com.sky.business.sys.service.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sky.business.sys.domain.SystemConfig;
import com.sky.business.sys.mapper.SystemConfigMapper;
import com.sky.business.sys.service.SystemConfigService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.NoSuchElementException;

@Service
public class SystemConfigServiceImpl extends ServiceImpl<SystemConfigMapper, SystemConfig> implements SystemConfigService {

    @Resource
    private SystemConfigMapper mapper;

    @Override
    public SystemConfig getSystemConfig() {
        List<SystemConfig> list= mapper.selectList(Wrappers.emptyWrapper());
        try{
            return list.get(0);
        }catch (NoSuchElementException e){
            return new SystemConfig();
        }
    }
}
